package com.guoyansoft.model.service.impl;

import com.guoyansoft.config.R;
import com.guoyansoft.model.dao.StatisticalReportDao;
import com.guoyansoft.model.pojo.StatisticalReport;
import com.guoyansoft.model.service.StatisticalReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class StatisticalReportServiceImpl implements StatisticalReportService {
    @Autowired
    private StatisticalReportDao statisticalReportDao;
    @Override
    public R save(StatisticalReport statisticalReport) {
        int row = statisticalReportDao.insert(statisticalReport);
        return row>0?R.suc():R.fail();
    }

    @Override
    public R queryByPage(Map<String, Object> params) {
        Long total = statisticalReportDao.selectTotal(params);
        List<StatisticalReport> statisticalReports = statisticalReportDao.selectByPage(params);
        return R.suc(total,statisticalReports);
    }

    @Override
    public StatisticalReport queryByNo(String no) {
        StatisticalReport statisticalReport = statisticalReportDao.selectByNo(no);
        return statisticalReport;
    }
}
